<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1 {
            height: 400px;
            width: 600px;
            border: 1px solid brown;
            margin: auto;
        }

        .box1 .box2 {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid brown;
        }

        h3 {
            margin: 10px 0 10px 20px;
        }

        a {
            margin: 10px 20px 10px 0;
            font-size: 15px;
            color: black;
            text-decoration: none;

        }
        a:hover{
            background-color: brown;
            color: white;
            border-radius: 25%;
        }

        .box1 .box3 {
            margin: 30px;
            height: 300px;
        }

        .box3 img {
            height: 100%;
            width: 100%;
        }
    </style>
</head>

<body>
    <div class="box1">
        <div class="box2">
            <h3>每日周澎</h3>
            <a href="" class="lj" data-a="0">精选</a>
            <a href="" class="lj" data-a="1">美食</a>
            <a href="" class="lj" data-a="2">百货</a>
            <a href="" class="lj" data-a="3">个护</a>
            <a href="" class="lj" data-a="4">预告</a>
        </div>
        <div class="box3">
            <img src="./../images/course01.png" alt="">
        </div>
    </div>
    <script>
        const arr = [
            { url: './../images/course01.png' },
            { url: './../images/course02.png' },
            { url: './../images/course03.png' },
            { url: './../images/course04.png' },
            { url: './../images/course05.png' }
        ]
        const a = document.querySelectorAll('.lj')
        const img = document.querySelector('img')

        a.forEach(item => {
            item.addEventListener('mouseenter', function() {
                const index = parseInt(this.getAttribute('data-a'));
                img.src = arr[index].url;

            });
        });


        




    </script>
</body>

</html>